<% if (locals.user) { %>
  <div id="menu"> <!-- 给已登录用户的菜单 -->
    <span class="name"><%= user.name %></span>
    <a href="/post">post</a>
    <a href="/logout">logout</a>
  </div>
<% } else { %>
  <div id="menu"> <!-- 给匿名用户的菜单 -->
    <a href="/login">login</a>
    <a href="/register">register</a>
  </div>
<% } %>
